import { Column, Entity, ManyToMany, PrimaryGeneratedColumn } from 'typeorm'
import { User } from '../user/user.entity'
import { Expose } from 'class-transformer'
import { RoleEnum } from '../enum/role.enum'
@Entity()
export class Roles {
  @PrimaryGeneratedColumn()
  @Expose()
  id: number

  @Column()
  @Expose()
  name: string

  @Column({ type: 'enum', enum: RoleEnum, default: RoleEnum.User })
  @Expose()
  role: RoleEnum

  @Expose()
  @ManyToMany(() => User, (user) => user.roles)
  users: User[]
}
